import { numberFormat } from "@/util/util.js";
export const tableOptionDetailsView = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  selection: false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
    },
     {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      }
    },  {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
    },	  {
      "type": "number",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum",
      display: false,
      hide: true
    }, {
      "type": "number",
      "label": "废票张数 ",
      "prop": "invalidTicketNum",
      display: false,
      hide: true
    },	  {
      "type": "input",
      "label": "创建时间",
      "prop": "createTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "数据更新时间",
      "prop": "updateTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "删除标志 1：删除 0：未删",
      "prop": "delFlag",
      hide:true,
    }  ]
}

export const tableOptionReturnDetailsView = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  selection: false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
    },
     {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      }
    },  {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
    },	  {
      "type": "number",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum"
    }, {
      "type": "number",
      "label": "废票张数 ",
      "prop": "invalidTicketNum"
    }, {
      "type": "number",
      "label": "即时替换张数 ",
      "prop": "replaceTicketNum"
    }, {
      "type": "number",
      "label": "现金售卖张数 ",
      "prop": "cashSaleNum"
    }, {
      "type": "number",
      "label": "现金售卖金额 ",
      "prop": "cashSaleAmount"
    }, {
      "type": "number",
      "label": "微信售卖张数 ",
      "prop": "wechatSaleNum"
    }, {
      "type": "number",
      "label": "微信售卖金额 ",
      "prop": "wechatSaleAmount"
    }, {
      "type": "number",
      "label": "支付宝售卖张数 ",
      "prop": "alipySaleNum"
    }, {
      "type": "number",
      "label": "支付宝售卖金额 ",
      "prop": "alipySaleAmount"
    }, {
      "type": "number",
      "label": "POS机售卖张数 ",
      "prop": "posSaleNum"
    }, {
      "type": "number",
      "label": "POS机售卖金额 ",
      "prop": "posSaleAmount"
    }, {
      "type": "select",
      "label": "POS卡类型",
      "prop": "posCardType",
	   hide:true,
       dicUrl:'/admin/dict/type/pos_card_type'
    }, {
      "type": "select",
      "label": "POS支付方式",
      "prop": "posPayType",
	   hide:true,
       dicUrl:'/admin/dict/type/pos_pay_type'
    }, {
      "type": "input",
      "label": "创建时间",
      "prop": "createTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "数据更新时间",
      "prop": "updateTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "删除标志 1：删除 0：未删",
      "prop": "delFlag",
      hide:true,
    }  ]
}
export const tableOptionDetails = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      cell: true,
      cascaderItem: ["ticketType"],
      rules: [{
        required: true,
        message: '请选择票种',
        trigger: 'blur'
      }]
    },
    {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      //filterable: true,
      //cell: true,
      dicUrl: '/support/swpmticketcardtypeparam/dict/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      component: 'ticket-name-select',
      params: {
        valueKey: 'ticketValue',
        unitKey: 'ticketUnit'
      },
      rules: [{
        required: true,
        message: '请选择车票名称',
        trigger: 'blur'
      }]
    },
    /*{
      "type": "select",
      "label": "车票名称",
      //：单程票、纪念票、计次票、定值票、长安通卡、公务票
      "prop": "ticketType",
      cell:true,
      dicUrl:'/support/swpmticketcardtypeparam/dict',
      component: 'ticket-name-select',
      params: {
        valueKey: 'ticketValue',
        unitKey: 'ticketUnit'
      }
    },*/
    {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
      cell:true,
    },	  {
      "type": "input",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum",
      hide:true,
    },	  {
      "type": "input",
      "label": "创建时间",
      "prop": "createTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "数据更新时间",
      "prop": "updateTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "删除标志 1：删除 0：未删",
      "prop": "delFlag",
      hide:true,
    }  ]
}


export const tableOptionDetailsNewAdd = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      cell: true,
      cascaderItem: ["ticketType"],
      rules: [{
        required: true,
        message: '请选择票种',
        trigger: 'blur'
      }]
    },
     {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dict/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      component: 'ticket-name-select',
      params: {
        valueKey: 'ticketValue',
        unitKey: 'ticketUnit'
      },
      rules: [{
        required: true,
        message: '请选择车票名称',
        trigger: 'blur'
      }]
    },	  {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
      cell:true,
    },	  {
      "type": "input",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum",
      hide:true,
    },	  {
      "type": "datetime",
      "label": "操作时间",
      "prop": "createTime",
      valueFormat:'yyyy-MM-dd HH:mm:ss',
      format:'yyyy-MM-dd HH:mm:ss',
      dateDefault:true,
      cell:true,
    },	  {
      "type": "input",
      "label": "数据更新时间",
      "prop": "updateTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "删除标志 1：删除 0：未删",
      "prop": "delFlag",
      hide:true,
    }  ]
}


export const tableOptionDetailsNewView = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      }
    },
     {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      }
    },	  {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
      cell:true,
    },	  {
      "type": "input",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum",
      hide:true,
    },	  {
      "type": "datetime",
      "label": "操作时间",
      "prop": "createTime",
      valueFormat:'yyyy-MM-dd HH:mm:ss',
      format:'yyyy-MM-dd HH:mm:ss',
      dateDefault:true,
      cell:true,
    },	  {
      "type": "input",
      "label": "数据更新时间",
      "prop": "updateTime",
      hide:true,
    },	  {
      "type": "input",
      "label": "删除标志 1：删除 0：未删",
      "prop": "delFlag",
      hide:true,
    }  ]
}


export const tableOptionDetailsReturn = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  header:false,
  selection: false,
  menu:false,
  "column": [
	  {
      "type": "input",
      "label": "唯一标识",
      "prop": "id",
      hide:true,
    },	  {
      "type": "input",
      "label": "关键主表ID",
      "prop": "relationId",
      hide:true,
    },	  {
      "type": "input",
      "label": "类型",
      //：0 首次配票 1新增配票 2归还配票
      "prop": "type",
      hide:true,
    },
    	{
      label: '票种',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict/ticket',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
    },
     {
      label: '车票名称',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      props: {
        label: 'subName',
        value: 'subEnName'
      }
    },	  {
      label: '金额/次数',
      prop: 'ticketValue',
      type: 'input',
      formatter: function(row,value,label,column){
        return `${row.ticketValue==null?'':row.ticketValue}${row.ticketUnit||''}`
      }
    }, {
      "type": "input",
      "label": "单位",
      "prop": "ticketUnit",
      hide: true
    },	  {
      "type": "number",
      "label": "开窗张数",
      "prop": "windowsNum",
    },	  {
      "type": "number",
      "label": "关窗张数 ",
      "prop": "windowsCloseNum",
      cell:true,
    },  {
      "type": "number",
      "label": "废票张数 ",
      "prop": "invalidTicketNum",
      cell:true,
    },  {
      "type": "number",
      "label": "即时替换张数 ",
      "prop": "replaceTicketNum",
      cell:true,
    },  {
      "type": "number",
      "label": "现金售卖张数 ",
      "prop": "cashSaleNum",
      cell:true
    },  {
      "type": "number",
      "label": "现金售卖金额 ",
      "prop": "cashSaleAmount",
      precision: 2,
      formatter: (row, value, label, column) => {
        const ticketValue = row.ticketValue;
        const cashSaleNum = row.cashSaleNum;
        let sum = 0;
        if (!isNaN(ticketValue)&&!isNaN(cashSaleNum)) {
          sum = ticketValue*cashSaleNum;
        }
        row.cashSaleAmount = sum;
        return numberFormat(sum, column.precision);
      }
    },  {
      "type": "number",
      "label": "微信售卖张数 ",
      "prop": "wechatSaleNum",
      cell:true
    },  {
      "type": "number",
      "label": "微信售卖金额 ",
      "prop": "wechatSaleAmount",
      precision: 2,
      formatter: (row, value, label, column) => {
        const ticketValue = row.ticketValue;
        const wechatSaleSum = row.wechatSaleNum;
        let sum = 0;
        if (!isNaN(ticketValue)&&!isNaN(wechatSaleSum)) {
          sum = ticketValue*wechatSaleSum;
        }
        row.wechatSaleAmount = sum;
        return numberFormat(sum, column.precision);
      }
    },  {
      "type": "number",
      "label": "支付宝售卖张数 ",
      "prop": "alipySaleNum",
      cell:true
    },  {
      "type": "number",
      "label": "支付宝售卖金额 ",
      "prop": "alipySaleAmount",
      precision: 2,
      formatter: (row, value, label, column) => {
        const ticketValue = row.ticketValue;
        const alipySaleNum = row.alipySaleNum;
        let sum = 0;
        if (!isNaN(ticketValue)&&!isNaN(alipySaleNum)) {
          sum = ticketValue*alipySaleNum;
        }
        row.alipySaleAmount = sum;
        return numberFormat(sum, column.precision);
      }
    },  {
      "type": "number",
      "label": "POS机售卖张数 ",
      "prop": "posSaleNum",
      cell:true
    },  {
      "type": "number",
      "label": "POS机售卖金额 ",
      "prop": "posSaleAmount",
      precision: 2,
      formatter: (row, value, label, column) => {
        const ticketValue = row.ticketValue;
        const posSaleNum = row.posSaleNum;
        let sum = 0;
        if (!isNaN(ticketValue)&&!isNaN(posSaleNum)) {
          sum = ticketValue*posSaleNum;
        }
        row.posSaleAmount = sum;
        return numberFormat(sum, column.precision);
      }
    }, {
      "type": "select",
      "label": "POS卡类型",
      "prop": "posCardType",
       dicUrl:'/admin/dict/type/pos_card_type' ,
	   width: 180,
      hide: true,
       cell:true
    }, {
      "type": "select",
      "label": "POS支付方式",
      "prop": "posPayType",
       dicUrl:'/admin/dict/type/pos_pay_type' ,
	   hide:true,
       cell:true
    }]
}
